import request from '@/utils/request'

// 查询内容标签关联列表
export function listClassify(query) {
  return request({
    url: '/classify/classify/list',
    method: 'get',
    params: query
  })
}

// 查询内容标签关联详细
export function getClassify(id) {
  return request({
    url: '/classify/classify/' + id,
    method: 'get'
  })
}

// 新增内容标签关联
export function addClassify(data) {
  return request({
    url: '/classify/classify',
    method: 'post',
    data: data
  })
}

// 修改内容标签关联
export function updateClassify(data) {
  return request({
    url: '/classify/classify',
    method: 'put',
    data: data
  })
}

// 删除内容标签关联
export function delClassify(id) {
  return request({
    url: '/classify/classify/' + id,
    method: 'delete'
  })
}

// 单条切换认证
function toggleVerify(item) {
  const newStatus = item.isVerified == 1 ? 0 : 1;
  updateClassify({ id: item.id, isVerified: newStatus }).then(() => {
    item.isVerified = newStatus;
    proxy.$modal.msgSuccess(newStatus ? "已认证" : "已取消认证");
  });
}

// 批量认证
export function batchVerifyApi(ids) {
  return request({
    url: '/classify/classify/batchVerify',
    method: 'post',
    data: ids
  })
}

// 批量取消认证
export function batchUnverifyApi(ids) {
  return request({
    url: '/classify/classify/batchUnverify',
    method: 'post',
    data: ids
  })
}

